#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
#define REP(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define PER(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)

template<typename T=int>
inline T read() {
    T x;
    cin >> x;
    return x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll a, b, c;
    while (cin >> a >> b) {
        if (a == 0 && b == 0)break;
        REP(c, 0, 100) {
            ll d = a * 100 + c;
            if (d % b == 0) {
                cout << c / 10 << c % 10 << " ";
            }
        }
        cout << endl;
    }
    return 0;
}
